# Check the AXPY
which clang++

LLVM_OBJ_PATH=/data/hongyi/cudaflow/third_party/llvm/build
CUDA_PATH=/usr/local/cuda-12
TEST_CASE=axpy

# Comple the CUDA to Object (Step by Step)
$LLVM_OBJ_PATH/bin/clang-21 -cc1 -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu \
        -dumpdir test/$TEST_CASE.out- -disable-free -clear-ast-before-backend \
        -disable-llvm-verifier -discard-value-names -main-file-name $TEST_CASE.cu \
        -mrelocation-model static -mframe-pointer=all -fno-rounding-math \
        -no-integrated-as -aux-target-cpu x86-64 -fcuda-is-device -mllvm \
        -enable-memcpyopt-without-libcalls -fno-threadsafe-statics -fcuda-allow-variadic-functions -mlink-builtin-bitcode $CUDA_PATH/nvvm/libdevice/libdevice.10.bc \
        -target-sdk-version=12.6 -target-cpu sm_80 -target-feature +ptx85 -debugger-tuning=gdb \
        -fno-dwarf-directory-asm -fdebug-compilation-dir=/data/hongyi/cudaflow -resource-dir $LLVM_OBJ_PATH/lib/clang/21 \
        -internal-isystem $LLVM_OBJ_PATH/lib/clang/21/include/cuda_wrappers -include __clang_cuda_runtime_wrapper.h -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 \
        -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward \
        -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 \
        -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem $LLVM_OBJ_PATH/lib/clang/21/include -internal-isystem /usr/local/include \
        -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu \
        -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem $CUDA_PATH/include -internal-isystem $LLVM_OBJ_PATH/lib/clang/21/include \
        -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include \
        -internal-externc-isystem /usr/include \
        -fdeprecated-macro -fno-autolink -ferror-limit 19 -fmessage-length=186 --offload-new-driver -pthread \
        -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -cuid=196f7c47be2c6202 \
        -D__GCC_HAVE_DWARF2_CFI_ASM=1 -emit-llvm -o ./test/$TEST_CASE-sm_80.ll -x cuda test/$TEST_CASE.cu